Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: How to know when a player is walking/running?

  1. #1
    Client Beta Testers Appelpitje's Avatar
    Join Date
    Jan 2012
    Location
    Belgium
    Posts
    545

    Default How to know when a player is walking/running?

    As the titles says..

    How can you find out when a player is moving/walking?

  2. #2

    Default

    Code:
    moveposflags ( String position, [String movement] )    
    
    used by the state files to tell the game dll what the player is doing
    Use getmovement to query the above and it should tell you what the player is doing.

    Code:
    //am I running?
    local.movement =  ( local.player getmovement ) 
    
    if(local.movement == "running")
    {
    iprintlnbold_noloc "Yes I am running, we learn something everyday"
    }
    Last edited by Elgan; May 6th, 2013 at 01:49 PM.

  3. #3
    Client Beta Testers Appelpitje's Avatar
    Join Date
    Jan 2012
    Location
    Belgium
    Posts
    545

    Default

    Thanks, but i just tried this on SH and its not working.
    Is the AA or reborn only?

  4. #4

    Default

    whats console say

  5. #5
    Client Beta Testers Appelpitje's Avatar
    Join Date
    Jan 2012
    Location
    Belgium
    Posts
    545

    Default

    The console says nothing

  6. #6

    Default

    turn logfile 3 on and set developer 1

    and try again; if the command didnt work, it would error ..but it does work, so you have any error somewhere else.

    maybe put in some printlns and find out whats going on,

  7. #7
    Client Beta Testers Appelpitje's Avatar
    Join Date
    Jan 2012
    Location
    Belgium
    Posts
    545

    Default

    Yeah that showwed me an error:

    ^~^~^ Script Error: Cannot cast 'NIL' to listener

    local.movement = ( local.player getmovement ) (global/detectwalking.scr, 5)
    local.movement = ( local.player ^

  8. #8

    Default

    put this above
    Code:
    if(local.player == NIL)
    {
    local.player= " NIL"
    }
    iprintln (" Player is " + local.player )
    and tell me what it prints.

  9. #9

    Default

    or show us the rest of your code

  10. #10
    Client Beta Testers Appelpitje's Avatar
    Join Date
    Jan 2012
    Location
    Belgium
    Posts
    545

    Default

    Just your code to see if the println does something, then i will try to add some stuff.

    Code:
    //am I running?
    if(local.player == NIL)
    {
    local.player= " NIL"
    }
    iprintln (" Player is " + local.player )
    
    {
    local.movement =  ( local.player getmovement ) 
    if(local.movement == "running")
    {
    println "Yes I am running, we learn something everyday"
    }
    }
    Error now:

    Code:
    local.movement =  ( local.player getmovement )  (global/detectwalking.scr, 9)
    local.movement =  ( local.player ^
    
    ^~^~^ Script Error: There are 0 entities with targetname ' NIL'. You are using a command that requires exactly one.
    Last edited by Appelpitje; May 7th, 2013 at 11:12 AM.

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •